package com.project.server.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.time.LocalDate;
import java.time.LocalTime;
import java.time.LocalDateTime;

@Data
@Schema(description = "预订请求")
public class ReservationRequest {

    @Schema(description = "餐厅ID")
    @NotNull(message = "餐厅ID不能为空")
    private Long restaurantId;

    @Schema(description = "餐桌ID")
    @NotNull(message = "餐桌ID不能为空")
    private Long tableId;

    @Schema(description = "预订日期")
    @NotNull(message = "预订日期不能为空")
    private LocalDate date;

    @Schema(description = "预订时间")
    @NotNull(message = "预订时间不能为空")
    private LocalTime time;

    @Schema(description = "用餐人数")
    @NotNull(message = "用餐人数不能为空")
    @Min(value = 1, message = "用餐人数最少1人")
    private Integer personCount;

    @Schema(description = "联系人")
    private String contactName;

    @Schema(description = "联系电话")
    @NotBlank(message = "联系电话不能为空")
    private String contactPhone;

    @Schema(description = "备注")
    private String remark;

    // 转换为 LocalDateTime
    public LocalDateTime getReservationTime() {
        return LocalDateTime.of(date, time);
    }




}
